package com.we.mexico.flink.utils;

import org.apache.flink.streaming.connectors.kafka.partitioner.FlinkKafkaPartitioner;

public class WeKafkaPartitioner extends FlinkKafkaPartitioner<String> {
    @Override
    public int partition(
            String record, byte[] key, byte[] value, String targetTopic, int[] partitions) {
        int partition = Math.abs(new String(key).hashCode() % partitions.length);
        return partition;
    }
}
